package com.codergd.gra.dao;

import com.codergd.gra.bean.Job;
import com.codergd.gra.bean.Orders;
import com.codergd.gra.vo.ComFive;
import com.codergd.gra.vo.JobFive;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface OrderDao {

    @Insert("insert into orders(time,total,comid,jobid) values(#{time},#{total},#{comid},#{jobid})")
    public int insertOrder(Orders orders);

    @Select("select t2.stotal,t1.comname from (select comid, sum(total) as stotal from orders group by comid order by stotal desc limit 5) as t2,com as t1 where t1.id = t2.comid")
    public List<ComFive> selectCom();

    @Select("select * from job where wit < 1000 order by wit desc limit 5")
    public List<Job> selectJob();

    @Select("select job,count(job) as cojob from userre group by job order by cojob desc limit 5")
    public List<JobFive> selectJob1();
}
